define([],function(){
    function pageLogic(config){
      this.pageview = config.pageview;
      this.pcpreviewdom = this.pageview.showPageParams.dom;
      this.pcpreviewdom.removeClass("dc-designer-wrapper-right");
      this.content = this.pageview.showPageParams.content;
    }
    pageLogic.prototype = {
      segment_didmount:function(sender){
        sender.components[0].select();
      },
      web_view_body_didmount:function(sender){
        sender.$el.append(this.pcpreviewdom);
        sender.$el.append($('<div data-comname="range_personselector" class="ds-person-selector yy-hbox" style="cursor: pointer; min-height: 30px; border: 1px solid rgb(238, 238, 238); border-radius: 4px; width: 100%; margin-bottom: 12px; margin-top: 6px;"><div data-comname="undefined" class="yy-hbox-column" style="vertical-align: middle;"><div data-comname="tips_repeat" class="yy-repeat" style="color: rgb(166, 168, 169); font-size: 12px; overflow: hidden; padding: 4px;"><div data-comname="repeat_nodata" class="yy-text ai-center"><span class="yy-pretext"></span><span title="所有人可见" class="yy-inner-text yy-text-box">所有人可见</span><span class="yy-nexttext"></span></div></div></div><div data-comname="undefined" class="yy-hbox-column" style="width: 26px; vertical-align: bottom;"><div data-comname="add_range_icon" class="yy-icon yy-icon-h" style="top: -4px;"><i class="yy-icon-code" data-code="e90b" data-icon="" style="font-family: icomoon; font-size: 20px; color: rgb(170, 170, 170);"></i></div></div></div><div data-comname="uploader" class="yy-view" style="margin-bottom: 15px;"><div data-comname="uploader_text" class="yy-text ai-center" style="display: inline-block; font-size: 14px; color: rgb(102, 102, 102);"><span class="yy-pretext"></span><span title="附件" class="yy-inner-text yy-text-box">附件</span><span class="yy-nexttext"></span></div><button data-comname="uploader_button" class="yy-btn yy-btn-1" type="button" style="display: inline-block; background-color: rgb(31, 218, 154); width: 60px; height: 32px; border: none; color: rgb(255, 255, 255); margin-left: 14px;">上传</button><div data-comname="uploader_repeat" class="uploader_repeat yy-repeat" style="margin-top: 8px;"></div></div>'));
      },
      mobild_webview_init:function(sender,params){
        sender.config.src = this.pageview.pageManager.appConfig.previewurl;
      },
      mobild_webview_afterload:function(sender,params){

        var _this = this;
        window.setTimeout(function(){
          params.frame.application.pagesClass[0].createLayout(_this.content);
        },2000);

      },
      segment_itemclick:function(sender,params){
        sender.select();
        if(params.index===0){
          this.pageview.refs.statusview.changeStatus("web_view");
        }else{
          this.pageview.refs.statusview.changeStatus("mobild_view");
        }
      },
      closeBtn_click:function (sender,params){
          sender.pageview.close();
      }
    };
    return pageLogic;
});
